//
//  EFACalloutView.m
//  efairy
//
//  Created by XiangDongMBP on 2017/7/29.
//  Copyright © 2017年 East. All rights reserved.
//

#import "EFACalloutView.h"

@implementation EFACalloutView

- (instancetype)init {
    self = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil] firstObject];
    if (self) {
        ;
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    // 设置圆角
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = 4;
    
    // 设置回调
    self.userInteractionEnabled = YES;
    self.titleBgView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesture:)];
    [self.titleBgView addGestureRecognizer:tapGesture];
    
    UITapGestureRecognizer *naviTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(naviTapGesture:)];
    [self.naviImgView addGestureRecognizer:naviTapGesture];
}

- (void)tapGesture:(UITapGestureRecognizer *)gesture {
    if ([self.delegate respondsToSelector:@selector(calloutView:tapGestureTapped:)]) {
        [self.delegate calloutView:self tapGestureTapped:gesture];
    }
}
- (void)naviTapGesture:(UITapGestureRecognizer *)gesture {
    if ([self.delegate respondsToSelector:@selector(calloutView:naviTapGestureTapped:)]) {
        [self.delegate calloutView:self naviTapGestureTapped:gesture];
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
